import React, {useState, useContext, createContext} from 'react'

const CountContext = createContext();

function Some() {
  let count = useContext(CountContext);
  return (<div>{count}</div>)
}

export default function UseContext() {
  const [count, setCount] = useState(0);
  return (<>
    <p>you're clicked {count} times</p>
    <button onClick={() => setCount(count + 1)}>click me</button>
    <CountContext.Provider value={count}>
      <Some/>
    </CountContext.Provider>
  </>)
}
